#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit DAWR=P3^6;
sbit DACS=P3^2;
void yanshi(uchar xms);
void main(void)
	{
		uchar val,flag;
		DACS=0;
		DAWR=0;
		P0=0;
		while(1)
		{
			if(flag==0)
			{
				val+=5;
				P0=val;
				if(val==255)
				{
					flag=1;
				}
				yanshi(50);
			}
			else
			{
				val-=5;
				P0=val;
				if(val==0)
				{
					flag=0;
				}
				yanshi(50);
			}
		}
	}
void yanshi(uchar xms)
	{
		uchar i,j;
		for(i=xms;i>0;i--)
			for(j=110;j>0;j--);
	}
